import request from '/@/utils/request';
import {versions} from '../versions'

export function getUserList(query: object) {
    return request({
        url: `${versions}/system/user/list`,
        method: 'get',
        params: query
    })
}

export function getParams() {
    return request({
        url: `${versions}/system/user/params`,
        method: 'get'
    })
}

export function getEditUser(id: number) {
    return request({
        url: `${versions}/system/user/getEdit`,
        method: 'get',
        params: {id}
    })
}

export function addUser(data: object) {
    return request({
        url: `${versions}/system/user/add`,
        method: 'post',
        data: data
    })
}


export function editUser(data: object) {
    return request({
        url: `${versions}/system/user/edit`,
        method: 'put',
        data: data
    })
}

export function resetUserPwd(userId: number, password: string) {
    return request({
        url: `${versions}/system/user/resetPwd`,
        method: 'put',
        data: {userId, password}
    })
}

export function changeUserStatus(userId: number, status: number) {
    return request({
        url: `${versions}/system/user/setStatus`,
        method: 'put',
        data: {userId, status}
    })
}


export function deleteUser(ids: number[]) {
    return request({
        url: `${versions}/system/user/delete`,
        method: 'delete',
        data: {ids}
    })
}


